<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<link type="text/css" rel="stylesheet" 	href="#{request.contextPath}/css/siscob.css" />
</h:head>
<h:form>
	<p:panel header="Funcionários cadastrados" styleClass="panel"
		closable="true" closeTitle="Fechar">
		<h:panelGrid columns="3" cellpadding="5px">
			<p:outputLabel value="Nome:" for="nome" />
			<p:inputText id="nome" maxlength="50" size="60" value="#{funcionarioController.nome}" />
			<p:commandButton value="Listar" actionListener="#{funcionarioController.consultarPorNome()}" update="lista" styleClass="commandButton" />
		</h:panelGrid>

		<h:panelGrid>
			<p:dataTable value="#{funcionarioController.consultarTodos()}" var="funcionario" id="lista"
				rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row'}"
				rowIndexVar="rowIx" paginator="true" rows="10">

				<p:column>
					<f:facet name="header">
						<h:outputText value="Nome"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.nome}"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="CPF"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.cpf }"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Data Nascimento"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.dataNascimento }"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="endereço"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.endereco }"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Bairro"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.bairro }"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Município"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.municipio}"></h:outputText>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="UF"></h:outputText>
					</f:facet>
					<h:outputText value="#{funcionario.uf}"></h:outputText>
				</p:column>
					
				<p:column style="text-align: center;  width:70px;">

					<p:commandLink update="@form" title="Alterar">
						<h:graphicImage url="/imagens/icon-edit.png" />
						<f:setPropertyActionListener value="#{funcionario}"
							target="#{funcionarioc.cf}" />
					</p:commandLink>

				</p:column>
			</p:dataTable>
		</h:panelGrid>

	</p:panel>
</h:form>
</html>
